package cn.school.test;

import cn.school.dao.GradeMapper;
import cn.school.entity.Grade;
import cn.school.util.MybatisUtil;
import org.apache.ibatis.session.SqlSession;

import java.util.List;

/**
 * @author oldliu
 * @since 1.0
 */
public class Leve1Cache {
    public static void main(String[] args) {
        test1();
    }
    public static void test1(){
        SqlSession s= MybatisUtil.get();
        GradeMapper mapper = s.getMapper(GradeMapper.class);
        List<Grade> all = mapper.findALL();
        all.forEach(x->{
            System.out.println("年级的信息："+x);
            System.out.println("此年级的学生有：");
            x.getStus().forEach(System.out::println);
            System.out.println("&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&&");
        });
        //s.clearCache();//清除问题
        System.out.println(">>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>");
        List<Grade> all2 = mapper.findALL();
        System.out.println((all==all2)+"?>>>>>>>>>>>>>>>");
        System.out.println(all2);
        MybatisUtil.close(s);
    }

}
